package com.ewanghuiju.app.ui.shopmail.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewanghuiju.app.R;
import com.ewanghuiju.app.component.ImageLoader;
import com.ewanghuiju.app.model.bean.response.FanliOrderListResponBean;
import com.ewanghuiju.app.util.StringUtil;
import com.makeramen.roundedimageview.RoundedImageView;

/**
 * @author sj  qq:751943509
 * @class 订单列表 adapter
 * @time 2020/2/20
 */
public class FanliOrderListAdapter extends BaseQuickAdapter<FanliOrderListResponBean, BaseViewHolder> {
    private int mType;

    public FanliOrderListAdapter(int layoutResId, int type) {
        super(layoutResId);
        this.mType = type;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    protected void convert(BaseViewHolder helper, FanliOrderListResponBean item) {
        RoundedImageView riv_item_icon = helper.getView(R.id.riv_item_icon);
        ImageLoader.load(mContext, item.getShopimg(), riv_item_icon);

        TextView tv_shop_title = helper.getView(R.id.tv_shop_title);
        StringUtil.getTextStrFormat(tv_shop_title, "AA", item.getTitle());


        TextView tv_ygz = helper.getView(R.id.tv_ygz);
          //TODO 这里用状态判断
        if (mType == 1) {
            tv_ygz.setText("结算收入 ￥"+item.getIncome());
            tv_ygz.setTextColor(mContext.getResources().getColor(R.color.white));
            tv_ygz.setBackgroundResource(R.drawable.shape_mail_shop_yg_bg);
        } else if (mType == 2) {
            tv_ygz.setText("预估收入 ￥"+item.getIncome());
            tv_ygz.setTextColor(mContext.getResources().getColor(R.color.colorPrimary));
            tv_ygz.setBackgroundResource(R.drawable.corner_primary_stroke_3);
        }
        else if (mType == 3) {
            tv_ygz.setText("预估收入 ￥"+item.getIncome());
            tv_ygz.setTextColor(mContext.getResources().getColor(R.color.color_999));
            tv_ygz.setBackgroundResource(R.drawable.corner_eee_2);
        }

    }
}
